
/// <summary>
/// 移动状态
/// </summary>
public class MoveState : IState
{
    public MoveState(FSM manager)
    {
        this.manager = manager;
        this.parameter = manager.parameter;
    }

    public override  void OnEnter()
    {
        parameter.animator.Play("Run");
    }

    public override  void OnUpdate()
    {
        // 如果想按速度切换移动或奔跑动画
        // parameter.animator.SetFloat("speed", player.rb.velocity.magnitude);
        //受伤
        if (parameter.isHurt)
        {
            manager.TransitionState(StateType.Hit);
        }
        //速度为0
        if (parameter.rb.velocity.magnitude < 0.01f)
        {
            manager.TransitionState(StateType.Idle);
        }
        //闪避
        if (parameter.isDodging)
        {
            manager.TransitionState(StateType.Dodge);
        }
        //近战攻击
        if (parameter.isMeleeAttack)
        {
            manager.TransitionState(StateType.MeleeAttack);
        }

    }
    public override  void OnFixedUpdate()
    {
        manager.Move();
    }
    public override  void OnExit() { }
}
